<?php


namespace Littlexiaoshuishui\Upay;

class PayException extends \Exception
{
    const OK = array('code' => 200, 'message' => '');
    const ACCESS_DENIED = array('code' => 400, 'message' => 'Access denied.');
    const INSUFFICIENT_TICKET = array( 'code' => 402, 'message' => "Sorry, you've run out of tickets! Buy more to keep playing!");
    const INTERNAL_ERROR = array('code' => 500, 'message' => 'Internal server error.');
    const INVALID_PARAMS = array('code' => 501, 'message' => 'valid params');


    public function __construct($code, $customMessage = '')
    {
        if (!empty($customMessage)) {
            $code['message'] = $customMessage;
        }
        parent::__construct($code['message'], $code['code']);
    }

}